package com.atguigu.ucenter.member.controller.client;

import com.atguigu.ucenter.member.entity.Member;
import com.atguigu.ucenter.member.entity.vo.MemberOrderVo;
import com.atguigu.ucenter.member.service.MemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author zy
 */
@RestController
@CrossOrigin
@RequestMapping("/ucenter/service/client")
@Api(value = "ClientMemberController", description = "获取用户信息 对接order")
public class ClientMemberController {

    @Resource
    private MemberService memberService;

    @ApiOperation("获取用户信息")
    @GetMapping("/getMemb/{id}")
    public MemberOrderVo getMemb(@PathVariable String id) {

        Member member = memberService.getMemberByToken(id);
        MemberOrderVo memberOrderVo = new MemberOrderVo();
        BeanUtils.copyProperties(member, memberOrderVo);
        return memberOrderVo;
    }
}
